import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReportVO, ReportForm, ReportQuery } from './types';

/**
 * 查询行业报告列表
 * @param query
 * @returns {*}
 */

export const listReport = (query?: ReportQuery): AxiosPromise<ReportVO[]> => {
  return request({
    url: '/wiki/report/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询行业报告详细
 * @param id
 */
export const getReport = (id: string | number): AxiosPromise<ReportVO> => {
  return request({
    url: '/wiki/report/' + id,
    method: 'get'
  });
};

/**
 * 新增行业报告
 * @param data
 */
export const addReport = (data: ReportForm) => {
  return request({
    url: '/wiki/report',
    method: 'post',
    data: data
  });
};

/**
 * 修改行业报告
 * @param data
 */
export const updateReport = (data: ReportForm) => {
  return request({
    url: '/wiki/report',
    method: 'put',
    data: data
  });
};

/**
 * 删除行业报告
 * @param id
 */
export const delReport = (id: string | number | Array<string | number>) => {
  return request({
    url: '/wiki/report/' + id,
    method: 'delete'
  });
};
